library(devtools)
source_url("https://gitee.com/ry2an/my_public_functions_r/raw/master/paste_vec.R")

# input <- list(c("2022-01-01", "2022-02-01"),
#               c("人数", "人次"),
#               c("门诊", "住院"),
#               c("筛选", "入组", "随访"),
#               c("药物", "企业"))

muldatagen <- function(input = list()){
  for(i in 1:length(input)){
    eval(parse(text = paste("vec",i," <- c()", sep = "")))
  }
  
  for(i in 1:length(input)){
    if(i > 1){
      eval(parse(text = paste("vec",i,"<- rep(input[[",i,
                              "]], each = length(vec",i-1 ,"))", sep = "")))
      for(j in 1:(i-1)){
        eval(parse(text = paste("vec",j," <- rep(vec",j,
                                ", length(input[[",i,"]]))", sep = "")))
      }
      
    }else{
      vec1 <- input[[1]]
    }
  }
  
  eval(parse(text = paste("out_df <- data.frame(",
                          paste_vec(paste("vec",1:length(input), sep =""), sep = ","),
                          ")", sep = "")))
  return(out_df)
}